package com.ruoyi.workflow.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.ArrayList;
import java.util.List;

/**
 * 物品分类管理信息对象 goods_category
 *
 * @author xiaodeng
 * @date 2022-11-27
 */
@Getter
@Setter
@TableName("goods_category")
public class GoodsCategory extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @TableId(type = IdType.AUTO)
    @TableField("id")
    private Long id;

    /** 分类名称 */
    @Excel(name = "分类名称")
    @TableField("category_name")
    private String categoryName;

    /** 描述 */
    @Excel(name = "描述")
    @TableField("category_desc")
    private String categoryDesc;

    /** id层级结构 */
    @TableField("busi_path")
    private String busiPath;

    /** 上级分类 */
    @Excel(name = "上级分类")
    @TableField("parent_id")
    private GoodsCategory parent;

    /** 子部门 */
    @TableField(exist = false)
    private List<GoodsCategory> children = new ArrayList<GoodsCategory>();

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("categoryName", getCategoryName())
            .append("categoryDesc", getCategoryDesc())
            .append("busiPath", getBusiPath())
            .append("parentId", getParent())
            .toString();
    }
}
